package com.qianfeng.zhangwei.fruitday.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.lidroid.xutils.BitmapUtils;
import com.qianfeng.zhangwei.fruitday.R;
import com.qianfeng.zhangwei.fruitday.bean.Banner;

import java.util.List;

/**
 * @说 明：
 * @项目名称：Sz1504Adv
 * @包 名： com.qianfeng.zhangwei.fruitday.adapter
 * @类 名： HomeBannerAdapter
 * @创 建人： zhangwei
 * @创建时间：2015-08-06 15:46
 * @版 本：v1.0
 * @修 改人：
 * @修改时间：
 * @修改备注：
 */
public class HomeBannerAdapter extends AppBaseAdapter<Banner> {
    BitmapUtils bitmapUtils;

    public HomeBannerAdapter(List<Banner> list, Context context) {
        super(list, context);
        bitmapUtils = new BitmapUtils(context);
        bitmapUtils.configDefaultLoadFailedImage(R.mipmap.ic_launcher);
        bitmapUtils.configDefaultLoadingImage(R.mipmap.ic_launcher);
    }

    @Override
    public View getItemView(int position, View convertView, ViewGroup parent) {
        ViewHolder vh;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.widget_item_banner_layout, parent, false);
            vh = new ViewHolder(convertView);
        } else {
            vh = (ViewHolder) convertView.getTag();
        }
        bitmapUtils.display(vh.img, list.get(position).getPhoto());

        return convertView;
    }

    public static class ViewHolder {
        public ImageView img;
        private Button removeBtn;
        private Button addBtn;
        private TextView count;


        public ViewHolder(View view) {
            img = (ImageView) view.findViewById(R.id.item_banner_img);
        }
    }

    public class MyOnClick implements View.OnClickListener {

        private int postion;
        private ViewHolder vh;


        @Override
        public void onClick(View v) {

            switch (v.getId()) {
//                vh.count.setText();
//                list.get(postion).setcun
            }


        }
    }


}
